import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
 import router from './router'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import Particles from 'particles.vue3';
import piniaPluginPersist from 'pinia-plugin-persist';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import VueVideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'

// 定义菜单数据
const menuData = [
    {
        path: 'homePage',
        meta: { title: '主页', roles: ['1', '2', '3', '4'] },
        component: () => import('@/views/home/homePage.vue')
    },
    {
        path: 'monitor',
        meta: { title: '监控', isMenu: true },
        children: [
            {
                path: 'realTime',
                meta: { title: '实时监控', roles: [ '2', '3', '4'] },
                component: () => import('@/views/video/videoTest.vue')
            },
            {
                path: 'history',
                meta: { title: '查看历史监控', roles: [ '2', '3', '4'] },
                component: () => import('@/views/video/historyNew.vue')
            },
            {
                path: 'abnormal',
                meta: { title: '异常入侵检测', roles: [ '2', '3', '4'] },
                component: () => import('@/views/video/abnormalRecogVideo.vue')
            },
            {
                path: 'personnel',
                meta: { title: '人员识别', roles: [ '2', '3', '4'] },
                component: () => import('@/views/video/peopleRecogVideo.vue')
            },
            // {
            //     path: 'fire',
            //     meta: { title: '火灾检测', roles: [ '2', '3', '4'] },
            //     component: () => import('@/views/video/fireRecogVideo.vue')
            // },
        ],
    },
    {
        path: 'track',
        meta: { title: '路线', isMenu: true },
        children: [
            {
                path: 'trackVideo',
                meta: { title: '路线跟踪', roles: [ '2', '3', '4'] },
                component: () => import('@/views/Track/trackVideo.vue')
            },
            {
                path: 'trackHistory',
                meta: { title: '查看历史路线', roles: [ '2', '3', '4'] },
                component: () => import('@/views/Track/trackHistory.vue')
            },
        ],
    },
    {
        path: 'alert',
        meta: { title: '警报' },
        children: [
            {
                path: 'historyAlarm',
                meta: { title: '历史警报', roles: [ '2', '3', '4'] },
                component: () => import('@/views/alarm/historyAlarm.vue')
            },
            {
                path: 'historyAnalyst',
                meta: { title: '历史警报分析', roles: [ '2', '3', '4'] },
                component: () => import('@/views/alarm/historyAnalyst.vue'),
            },
        ],
    },
    {
        path: 'personnel',
        meta: { title: '人员' },
        children: [
            {
                path: 'whitelist',
                meta: { title: '管理白名单', roles: [ '2', '3', '4'] },
                component: () => import('@/views/user/WhiteList.vue')
            },
            {
                path: 'blacklist',
                meta: { title: '管理黑名单', roles: [ '2', '3', '4'] },
                component: () => import('@/views/user/BlackList.vue')
            },
            {
                path: 'input',
                meta: { title: '录入信息', roles: [ '2', '3', '4'] },
                component: () => import('@/views/user/AddResident.vue')
            },
            {
                path: 'elderly',
                name: 'ElderList',
                meta: { title: '老人列表', roles: [ '2', '3', '4'] },
                component: () => import('@/views/user/ElderList.vue')
            },
        ],
    },
    {
        path: 'user',
        meta: { title: '用户管理', roles: [ '2', '3', '4'], isMenu: true },
        component: () => import('@/views/user/UserManage.vue')
    },
];
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

// 定义全局变量
app.config.globalProperties.$urls = {
    Url: 'http://localhost:8080',
};

app.use(VueVideoPlayer)
const pinia = createPinia()
pinia.use(piniaPluginPersist)
app.use(router)
app.use(pinia)



app.use(ElementPlus)
app.use(Particles)
app.mount('#app')